 $(document).ready(function(){    	
		    $("#redisForm").validate();	
		    //验证用户名的格式
		    jQuery.validator.addMethod("isName",function(value , element){		    	
				var nameFormat = /^[\u4e00-\u9fa5_a-zA-Z0-9_]+$/;	 						
				var nameLength = 0;
		            for (var i = 0; i < value.length; i++) {		            	
		               var length = value.charCodeAt(i);
		               if(length>=0&&length<=128)
		                {
		            	   nameLength += 1;
		                }
		                else
		                {
		                	nameLength += 2;
		                }
		            }
		         return this.optional(element) || (nameFormat.test(value) && 4 <= nameLength && nameLength <= 10);								
			},"确认输入的字符串长度在【4-10】个字符之间，不包含特殊字符");
		    //验证邮箱的正确格式
		    jQuery.validator.addMethod("isEmail",function(value , element){
				var isEmail = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
				return this.optional(element) || (isEmail.test(value));
			},"确认输入正确的邮箱格式");

		    //验证邮箱是否被注册过
		    jQuery.validator.addMethod("existEmail",function(value , element){
		    	var flag = true;
		    	$.ajax({  
		            type: 'POST',  
		            url: 'http://localhost:8080/checkEmail',
		            async:false,
		            data: {email: value},
		            dataType : "json",
		            success: function (data) {		            	
		            	flag = data;       	               
		            }  		           
		        });	
		    return this.optional(element) || flag;
			},"该邮箱已经被注册过了！");
		    //验证密码是否符合规范
		    jQuery.validator.addMethod("isPassword",function(value , element){
				var password = /^[a-zA-Z0-9_]{6,20}$/;
				return this.optional(element) || (password.test(value));
			},"仅限数字、大小写字母，长度为【6-20】");		    		   
        });